﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using CCWin;
using CRegex;
namespace weiqijiance.工位配置
{
    public partial class APsetting : CCSkinMain
    {
        public APsetting()
        {
            InitializeComponent();
        }

        private void APsetting_Load(object sender, EventArgs e)
        {
            iniclass objini = new iniclass();
            string path = "";
            path = System.Windows.Forms.Application.StartupPath + path + "\\安综检仪表配置.ini";
            string path1 = string.Format(@"{0}", path);
            objini.Ini(path1);
            textBox1.Text = objini.ReadValue("地沟", "扫描枪串口设置").Trim();
            check_time.Checked = objini.ReadValue("地沟", "地沟显示检测时间").Trim().Contains("是") ? true : false;

            chezhijiekaishi.Checked = objini.ReadValue("地沟", "地沟不需扫码直接开始").Trim().Contains("是") ? true : false;

            che_ddzj.Checked = objini.ReadValue("地沟", "只检单独综检").Trim().Contains("是") ? true : false;
            che_dpjxylx.Checked = objini.ReadValue("地沟", "增加底盘间隙仪录像").Trim().Contains("是") ? true : false;
            chk_smjyy.Checked = objini.ReadValue("地沟", "扫描检验员").Trim().Contains("是") ? true : false;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            CRegex.C_Regex.checkcom(textBox1.Text, true);

            iniclass objini = new iniclass();
            string path = "";
            path = System.Windows.Forms.Application.StartupPath + path + "\\安综检仪表配置.ini";
            string path1 = string.Format(@"{0}", path);
            objini.Ini(path1);
            objini.Writue("地沟", "扫描枪串口设置", textBox1.Text);
            objini.Writue("地沟", "地沟显示检测时间", check_time.Checked ? "是" : "否");
            objini.Writue("地沟", "地沟不需扫码直接开始", chezhijiekaishi.Checked ? "是" : "否");
            objini.Writue("地沟", "只检单独综检", che_ddzj.Checked ? "是" : "否");
            objini.Writue("地沟", "增加底盘间隙仪录像", che_dpjxylx.Checked ? "是" : "否");
            objini.Writue("地沟", "扫描检验员", chk_smjyy.Checked ? "是" : "否");
            MessageBox.Show("完成");

            基类窗体.UploadAndDownload fupload = new 基类窗体.UploadAndDownload();
            objini.Ini(System.Windows.Forms.Application.StartupPath + "\\系统信息.ini");
            string sjcxname = objini.ReadValue("系统信息", "检测线名称");
            string sgongweiname = objini.ReadValue("系统信息", "检测工位名称");
            fupload.upload(sjcxname, sgongweiname, "安综检仪表配置.ini");
        }
    }
}
